#ifndef F2FB_DATABASE_DATA_GATE_H
#define F2FB_DATABASE_DATA_GATE_H

#include <string>

#include <sqlite_modern_cpp.h>

namespace F2FB
{

namespace Database
{

class DataGate final
{
public:
    explicit DataGate(const std::string& databaseFilename)
        : m_database(new sqlite::database(databaseFilename)) {};

    template <typename Function, typename... Args>
    auto run(
        Function function,
        Args&&... args
    )
    {
        return function(*m_database, std::forward<Args>(args)...);
    }

private:
    std::unique_ptr<sqlite::database> m_database;
};

} // namespace Database

} // namespace F2FB

#endif // F2FB_DATABASE_DATA_GATE_H
